/**
 * @name 04_compileAndExecute
 */

import java

/* Refactor the logic into a predicate. */
predicate isOgnlSink(Expr arg) {
  exists (Method m, MethodAccess ma
  | m.getName() = "compileAndExecute" and
    ma.getMethod() = m and
    arg = ma.getArgument(0))
}

/* This query produces identical results to the previous one. We have just
 * refactored the logic into a separate predicate.
 */
from Expr arg
where isOgnlSink(arg)
select arg
